package com.wj.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.wj.constant.MessageConstant;
import com.wj.entity.Result;
import com.wj.pojo.CheckItem;
import com.wj.service.CheckItemService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: WangJin
 * @description
 * @date: 2021/10/10 22:55
 */
@RestController
@RequestMapping("/checkitem")
public class CheckItemController {
    //查找服务
    @Reference
    private CheckItemService checkItemService;
    //新增检查项
    @RequestMapping("/add")
    public Result add(@RequestBody CheckItem checkItem){
        try {
            checkItemService.add(checkItem);
        } catch (Exception e) {
            e.printStackTrace();
            //调用失败
            return new Result(false, MessageConstant.ADD_CHECKGROUP_FAIL);
        }
        return new Result(true,MessageConstant.ADD_CHECKGROUP_SUCCESS);
    }
}
